-- card: 41200 from stack: in -- bmap block id: 0 -- flags: 0000 -- background id: 4755 -- name: -- part 1 (field) -- low flags: 00 -- high flags: 0007 -- rect: left=30 top=78 right=296 bottom=478 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 4 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: -- part contents for card part 1 ----- text ----- /* * FILE: main.c * AUTHOR: R.G. * CREATED: June 25, 1990 * * main() function for class example * * PROJECT CONTENTS: * class.c, person.c, student.c, main.c * (For Think C, add the ANSI and oops libraries.) */ # include "person.h" # include "student.h" # include # include /* DELETE THIS LINE FOR C++ */ char get_choice(void); /* prototype for later definition */ /****************************************************************** * main() function ******************************************************************/ main() { Person *person[100]; /* array of Person-pointers */ char response; int i = 0, j; while (i<100 && ((response=get_choice()) != 'x')) { if (response == 'p') person[i++] = new(Person); else if (response == 's') person[i++] = new(Student); } for (j=0 ; jinit(); person[j]->set(); } } for (j=0 ; jprint(); printf("\n"); person[j]->destroy(); } delete(person[j]); } } /****************************************************************** * function to get choice from user ******************************************************************/ char get_choice(void) { char response, junk; printf("Add a person (p), student (s), or exit (x):\n"); scanf("%c",&response); scanf("%c",&junk); /* get unneeded linefeed character */ return response; } -- part contents for background part 7 ----- text ----- 137 -- part contents for background part 4 ----- text ----- File 7 of 7: